import * as React from 'react';
import {observer} from 'mobx-react'
import styles from './index.scss';

import RowBar from './RowBar'
const neverResolve = new Promise(() => {
});
function Suspender({suspend}) {
    if (suspend) {
        throw neverResolve;
    } else {
        return null;
    }
}

function Preload({show, children}) {
    return (
        <React.Suspense fallback={null}>
            {children}
            <Suspender suspend={!show} />
        </React.Suspense>
    );
}
interface IProps {
    patientTXX: string[]
    patientTXY: number[]
    titleLeft: string
    titleRight: string,
    EquipmentX:string[],
    EquipmentY:number[],
    
}

@observer
class Home extends React.Component<IProps> {

    constructor(props) {
        super(props);
    }


    public render() {
        const {patientTXX, patientTXY, titleLeft, titleRight,EquipmentX,EquipmentY} = this.props
        return (
            <div className={styles.twoTop}>
                <RowBar color={['#00ffff','#3893e5']} title={titleLeft} unit={''}
                        dataX={EquipmentX} dataY={EquipmentY} />
                
                <RowBar color={['#1BDF6F','rgba(27,223,111,0.24)']} unit={'单位/次数'}
                        title={titleRight} dataX={patientTXX} dataY={patientTXY} />
            </div>
        );
    }
}

export default Home;
